<link rel="stylesheet" type="text/css" href="/templates/styles/tabcontent.css">
<script type="text/javascript" src="/templates/scripts/tabcontent.js"></script>
<script type="text/javascript" src="/templates/scripts/tiny_mce/tiny_mce.js"></script>
<!--Tyni MCE-->
<script type="text/javascript">
    tinyMCE.init({
    // General options
    mode : "textareas",
    theme : "advanced",
    plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",

    // Theme options
    theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
    theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
    theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
    theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true,

    // Replace values for the template plugin
    template_replace_values : {
    username : "Some User",
    staffid : "991234"
}
});
</script>
<!--TyniMCE-->
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td class="bgtitle">
            <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                <tr>
                    <td width="20">
                        <img src="/templates/images/mui_ten.gif" /></td>
                    <td valign="bottom" class="title">Danh sách sản phẩm khuyến mãi</td>
                    <td width="10" valign="bottom">&nbsp;</td>
                </tr>
            </table>
        </td>
    </tr>     
    <tbody>
        <tr>
            <td valign="top">
                <table width="100%" style="border-collapse: collapse" border="0" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
                </table>
                <br>
                <!-- 3 menu cố định -->
                <div id="pettabs" class="indentmenu">
                    <ul>
                        <li>
                            <a href="#" rel="dog1" class="selected">
                                <strong>Sản phẩm</strong>
                            </a>
                        </li>
                        <li>
                            <a href="#" rel="dog2" class="">
                                <strong>Thêm sản phẩm </strong>
                            </a>
                        </li>
                        <li>
                            <a href="#" rel="dog3" class="">
                                <strong>Khuyến mãi</strong>
                            </a>
                        </li>
                    </ul>
                    <br style="clear: left">
                </div>

                <!-- Chọn menu nào thì tab đó xuất hiện -->
                <div style="border:1px solid #CCCCCC; width:960px; padding-bottom:0px; padding-left:0px; padding-right:0px; padding-top:0px;">
                    <!-- Dog 1, chèn nội dung vào đây --->
                    <div id="dog1" class="tabcontent" style="display: block;">
                        <!--hiện thị sản phẩm-->

                        <form action="/login" method="post" enctype="multipart/form-data" name="loginForm" id="loginForm" style="margin:0; padding:0" onsubmit="return verifyloginForm(this)">   
                            <table class="display dataTable" id="example" width='100%' align='center' border='0' cellpadding='2' cellspacing='0' bordercolor='#CCCCCC' style='border-collapse:collapse'>
                                <thead>
                                    <tr>
                                        <th height='30' class='bgmenupro border3' bgcolor='#DDDDDD'>
                                <div align='center'>
                                    <strong>STT</strong>
                                </div>
                                </th>
                                
                                <th class='bgmenupro border3' bgcolor='#DDDDDD'>
                                <div align='center'>
                                    <strong>Tên sản phẩm</strong>
                                </div>
                                </th>
                                <th class='bgmenupro border3' bgcolor='#DDDDDD'>
                                <div align='center'>
                                    <strong>Giá nhập</strong>
                                </div>
                                </th>
                                <th class='bgmenupro border3' bgcolor='#DDDDDD'>
                                <div align='center'>
                                    <strong>Số lượng</strong>
                                </div>
                                </th>
                                <th class='bgmenupro border3' bgcolor='#DDDDDD'>
                                <div align='center'>
                                    <strong>Giá bán</strong>
                                </div>
                                </th>
                                <th class='bgmenupro border3' bgcolor='#DDDDDD'>
                                <div align='center'>
                                    <strong>Còn tồn</strong>                     
                                </div>
                                </th>
                                <th class='bgmenupro border3' bgcolor='#DDDDDD'>
                                <div align='center'>
                                    <strong>Điểm</strong>                     
                                </div>
                                </th>
                                <th class='bgmenupro borderfull' bgcolor='#DDDDDD'>
                                <div align='center'>
                                    <strong>Tùy chỉnh</strong>                     
                                </div>
                                </th>
                                </tr>
                                </thead>
                                <tbody>
                                    <!--load đơn hàng-->
									{if isset($promotion)}
										{foreach from=$promotion item=p}    
											<tr>
												<td class='border3'>{$p@index+1}</td>
											
												<td class='border3'>{$p.name}</td>
												<td class='border3'>{$p.price|number_format} VND</td>
												<td class='border3'>{$p.number}</td>  
												<td class='border3'>{$p.company_price|number_format} VND</td>
												<td class='border3'>{$p.inventory}</td>
												<td class='border3'>{$p.point}</td>
												<td class='borderfull'>
													<div align='center'>
														
															<img src='/templates/images/deleteuser.png' border='0'>
														</a>
													</div>
												</td>
											</tr>
										{/foreach}
									{/if}
                                    <!--load xong -->
                                </tbody>
                               
                            </table>
                            <br>
                            <br>
                            <table align="center">
                                <tr>
                                    <td>
                                        <div align='center'>
                                            <input type="submit" id="button" name="button" value="Lưu CSDL">
                                            <input type="submit" id="button" name="button" value="Thoát không lưu">
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </form>
                        <br />
                        <!-- begin: popup!-->
                        <script language="javascript">

                            /*
                        Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
                        Permission granted to Dynamic Drive to feature script in archive
                        For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
                             */

                            var win = null;
                            function NewWindow(mypage,myname,w,h,scroll){
                            LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
                            TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
                            settings =
                                'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
                            win = window.open(mypage,myname,settings)
                        }

                        </script>
                        <!-- end: popup!-->
                        <!--/hiện thị sản phẩm-->
                    </div>

                    <!-- Dog 2, chèn nội dung vào đây --->
                    <div id="dog2" class="tabcontent" style="display: none;">                     
                        <form action="admin/addproduct" method="post" enctype="multipart/form-data" name="addproduct" id="addproduct" style="margin:0; padding:0" onsubmit="return verifyregisterForm(this)">
                            <table width="95%" border="0" cellpadding="3" cellspacing="0" bordercolor="#CCCCCC" style="font-family: Tahoma; font-size: 10pt; border-collapse:collapse; padding:10px">
                                <tbody>
                                    <tr>
                                        <td class="bgtitle" colspan="6">
                                            <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                                                <tr>
                                                    <td width="20">
                                                        <img src="/templates/images/mui_ten.gif" /></td>
                                                    <td valign="bottom" class="title">Thêm sản phẩm</td>
                                                    <td width="10" valign="bottom">&nbsp;</td>
                                                </tr>
                                            </table>
                                        </td>
                                        <td></td>
                                    </tr>  
                                    <tr>
                                        
                                        <td width="10%">Tên sản phẩm</td>
                                        <td width="20%">
                                            <input name="productname" type="text" class="box_input" id="productname" size="24">
                                        </td>                              
                                        <td width="10%">Hình ảnh</td>
                                        <td width="20%">
                                            <input name="image" type="text" class="box_input" id="image" size="24">
                                        </td>
                                        <td width=10% rowspan="4" valign="top">                                           
                                            <input type="button" name="button" id="addoneproduct" value="Thêm">                                        
                                        </td>
                                    </tr>
                                    <tr bgcolor="">
                                        
                                        <td valign="top">Bảo hành</td>
                                        <td>
                                            <input name="warranty" type="text" class="box_input" id="warranty" size="24">
                                        </td>
                                        <td valign="top">Số lượng</td>
                                        <td>
                                            <input name="number" type="text" class="box_input" id="number" size="24">
                                        </td>
                                    </tr>
                                    <tr bgcolor="">

                                        <td valign="top">Giá bán</td>
                                        <td valign="top">
                                            <input name="priece" type="text" class="box_input" id="priece" size="24">
                                        </td>
                                        <td valign="top">Giá nhập</td>
                                        <td valign="top">
                                            <input name="promotion" type="text" class="box_input" id="promotion" size="24">
                                        </td>
                                    </tr>
                                    <tr bgcolor=""> 

                                        <td valign="top">Khuyến mãi</td>
                                        <td>
                                            <input name="priece" type="text" class="box_input" id="priece" size="24">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td valign="top" colspan="2">Chi tiết sản phẩm</td>

                                    <tr>
                                        <td colspan="6">
                                            <textarea id="productdetail" name="productdetail" rows="15" cols="90" style="width: 80%">
                                            </textarea>
                                        </td>

                                    </tr>

                                </tbody>
                            </table> 
                        </form>
                    </div>
                    <!-- Dog 3, chèn nội dung vào đây --->
                    <div id="dog3" class="tabcontent" style="display: none;">
                        
						<!--Tạo khuyến mãi-->
						<form name="promotionbytime" id = "promotionbytime" action="/admin/promotion" method="post">
	<table width="400px" border="0" cellpadding="0" cellspacing="0" style="margin-top:15px; margin-left:15px">
		<tbody>
			<tr> 
				<td class="title16" style="width:130px; text-align: center">
					<!-- Thay đổi ở đây -->
					<strong>Khuyến mãi</strong>
				</td>
				<td style="width:65px; text-align: center">
					<input type="radio" name="promotion_on_off" value="1" {if $promotionbytime.enable == 1} checked{/if}>Có
				</td>
				<td>
					<input type="radio" name="promotion_on_off" value="0" {if $promotionbytime.enable == 0} checked{/if}>Không
				</td>
			</tr>
			<tr>
				<td>
					<img src="/templates/images/space.gif" height="10">
				</td>
			</tr>
		</tbody>
	</table>
	<table width="400px" border="0" cellpadding="5" cellspacing="0" style="margin-left:15px">
		<tbody>
			<tr>
				<td width=200px>
					<strong>Thời gian bắt đầu:</strong>
				</td>
				<td width=200px> 
					<span>
						<input type="text" name="datetimebegin" id="datetimebegin" value="{$promotionbytime.datebegin|date_format:"%m/%d/%Y %H:%M"}">
						<script>
$('#datetimebegin').datetimepicker({
currentText: "Hiện tại",
closeText: "Xong",
hourText: "Giờ",
minuteText: "Phút"
});
						</script>
					</span>
				</td>
			</tr>
			<tr>
				<td>
					<strong>Thời gian kết thúc:</strong>
				</td>
				<td>
					<span>
						<input type="text" name="datetimeend" id="datetimeend" value="{$promotionbytime.dateend|date_format:"%m/%d/%Y %H:%M"}">
						<script>
$('#datetimeend').datetimepicker({
currentText: "Hiện tại",
closeText: "Xong",
hourText: "Giờ",
minuteText: "Phút"	
});
						</script>
					</span> 
				</td>
			</tr>
			<tr>
				<td>
					<strong>Phần trăm khuyến mãi:</strong>
				</td>
				<td>
					<span>
						<input type="text" name="percentdiscount" value="{$promotionbytime.percentdiscount}" maxlength="2">
						<script>
$('#datetimend').datetimepicker({
currentText: "Hiện tại",
closeText: "Xong",
hourText: "Giờ",
minuteText: "Phút"	
});
						</script>
					</span> 
				</td>
			</tr>
			<tr>
				<td colspan="2" style="text-align: center;">

					<input type="submit" value="Lưu" name="submit" onclick="if(!checkdatetime()) return false;">
					<script type="text/javascript">
function checkdatetime()
						{
if ( Date.parse (document.getElementById("datetimebegin").value) < Date.parse (document.getElementById("datetimeend").value))
return true;
alert("Thời gian kết thúc phải lớn hơn thời gian bắt đầu!");
return false;
}
					</script>
					{if $promotion_start == 1} Đang diễn ra chương trình khuyến mãi
					{else} Hiện tại không có chương trình khuyến mãi
					{/if}
				</td>
			</tr>
		</tbody>
	</table>
</form>
						
						
                        <table width="100%" border="0" cellpadding="5" cellspacing="0"></table>
                    </div>
                </div>
            </td>
        </tr>
    </tbody>
</table>


<script type="text/javascript">
var mypets=new ddtabcontent("pettabs")
mypets.setpersist(true)
mypets.setselectedClassTarget("link")
mypets.init(0)
</script>
<br>